<?php

require_once( $_SERVER['DOCUMENT_ROOT'].'/../libs/smarty.inc' );

require_once( $_SERVER['DOCUMENT_ROOT'].'/../libs/smt_variables.php' );

require_once( $_SERVER['DOCUMENT_ROOT'].'/../libs/Class_DB.php' );

require_once( $_SERVER['DOCUMENT_ROOT'].'/../libs/Class_ERROR.php' );

require_once( $_SERVER['DOCUMENT_ROOT'].'/../libs/login.inc.php' );



if( !in_array( "J", $_SESSION['ADMIN_LOGIN']['AUTH_CD'] ) ) exit;



$db = new Class_DB;



$res = $db->query("SELECT * FROM D_NEWS ORDER BY news_id");



$cnt = 0;

while( $row = mysql_fetch_array( $res, MYSQL_ASSOC ) ){

	

	if( mb_strlen( $row['news_title'], "utf8" ) > 40 ){

		$row['news_title'] = mb_substr( $row['news_title'], 1, 40 ) . '...';

	}

	

	$newslist[] = $row;

	$cnt++;

}



$smarty->assign('news_type', array(1 => 'リリース', 2 => 'ニュース') );

$smarty->assign('newslist', $newslist);

$smarty->assign('cnt', $cnt);

$smarty->display('web-admin/news_index.html');



?>